#!/usr/bin/env python
#-*- coding:utf-8 -*-

import tornado.web
import tornado.ioloop
import settings
from config.utils import get_settings


class Application(tornado.web.Application):
    def __call__(self, request):
        if request.path.endswith("/"):
            request.path = request.path.rstrip("/")
        return super(Application, self).__call__(request)

application = Application(settings.root_urls, **settings.app_settings)

if __name__ == "__main__":
    application.listen(get_settings("listen_port", 8888))
    print("listen ...")
    tornado.ioloop.IOLoop.instance().start()
